package com.lyz.stringdemo;

import java.util.Scanner;

/**
 * @ClassName StringExec5
 * @Description 手机号屏蔽 13866668888（138****8888）
 * @Author 2214361854
 * @Date 2022/2/16 0:08
 * @Version 1.0
 */
public class StringExec2 {
    public static void main(String[] args) {
        String tel = "13866668888";
        System.out.println(telpb());
        System.out.println(telpb(tel));
    }
    public static String telpb(){
        Scanner scanner = new Scanner(System.in);
        System.out.println("请您输入您的手机号码：");
        String tel = scanner.next();

        String before = tel.substring(0,3);
        String after = tel.substring(7);
        String telpb = before + "****" + after;

        return telpb;
    }
    public static String telpb(String tel){
        String before = tel.substring(0,3);
        String after = tel.substring(7);
        String telpb = before + "****" + after;

        return telpb;
    }
}
